package com.zhiyou100.entity;

public class Emp {
    private int id;
    private String ename;
    private String nickname;
    private int sex;
    private double sal;
    private int rank;
    // did外键不能抄在这里
    // did放在该类中,没有意义;不能表现类与类之间的关系
    // private int did;
    // 类与类之间的关系,需要通过交换对象来完成,这样才能表明关系[外键]
    // 写入一个部门对象
    private Dept dept= new Dept();// 初始化一下

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }

    @Override
    public String toString() {
        return "Emp{" +
                "id=" + id +
                ", ename='" + ename + '\'' +
                ", nickname='" + nickname + '\'' +
                ", sex=" + sex +
                ", sal=" + sal +
                ", rank=" + rank +
                ", 部门名称=" + dept.getDname() +
                '}';
    }

    public Emp() {
    }

    public Emp(int id, String ename, String nickname, int sex, double sal, int rank, Dept dept) {
        this.id = id;
        this.ename = ename;
        this.nickname = nickname;
        this.sex = sex;
        this.sal = sal;
        this.rank = rank;
        this.dept = dept;
    }
}
